package com.study.services;

import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.study.model.jdao.IAddresdetailDAO;
import com.study.model.mdao.AddressdetailMapper;
import com.study.model.pojo.Addresdetail;
import com.study.util.MaxId;

/**
 * 用户详细收货地址服务层
 * @author 郭星
 *
 */
@Service
@Transactional(rollbackOn = Exception.class)
public class AddresdetailService {
	

	@Autowired
	IAddresdetailDAO dao;
	
	@Autowired
	AddressdetailMapper mapper;
	/**
	 * 查询指定id的收货地址
	 * @return
	 */
	public Addresdetail findByid(int id) {
		return dao.findByAdId(id);
	}
    /**
     * Wcx
     * 添加地址
     * @param cumeradiss
     * @param custer
     * @param famoney
     * @return
     */
	
	
	public int address(String adid,String cumeradiss, String custer, String famoney) {
		
		return mapper.address(adid,cumeradiss,custer,famoney);
	}
	/**
	 * 查找最大值
	 * @return
	 */
	public String selectmax() {
		Integer findMaxId = mapper.findMaxId();
		String ad_id = MaxId.generateNewOrderID(findMaxId);
		return ad_id;
	}	
}
